import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue';
import Main from '../views/Main.vue';


import Dingdan from '../views/Dingdan.vue';


Vue.use(VueRouter)

const routes = [
// 默认请求/，重定向到/login
    {path: '/', redirect: '/login' },
    {path:'/login',component:Login},
	{path:'/main',component:Main,
	children:[
		 {path: '/', redirect: '/home' },
		 {path:'/home',component:()=>import ('../views/Home.vue')},// 替代：import Home from '../views/Home.vue';
		 {path:'/community',component:()=>import ('../views/Community.vue')},
		 {path:'/mendian',component:()=>import ('../views/Mendian.vue')},
		 {path:'/yizhan',component:()=>import ('../views/Yizhan.vue')},
		 {path:'/shangpin',component:()=>import ('../views/Shangpin.vue')},
		 {path:'/dingdan',component:Dingdan,
				children:[
					 {path:'/mai',component:()=>import ('../views/Mai.vue')},
					 {path:'/qu',component:()=>import ('../views/Qu.vue')},
					  {path:'/shong',component:()=>import ('../views/Shong.vue')},
				]
		 },
	],},
	 
]

const router = new VueRouter({
  routes
})

export default router
